Many applications, and specifically server-based applications, are run in a stateful mode, meaning that the server running the particular applications maintains, or is responsible for keeping, the application state for the duration of an application session. A particular session state can include information relating to the status of individual components, controllers, views, and contexts, in addition to user interface (UI) elements and models, as well as the various data stored therein. Applications running in a stateful mode depend on the past interactions between users and the application within a particular session to determine the state, which allows the application or a process therein to be easily executed during multiple steps.
An application being run in a stateless mode generally does not keep significant session or other state information on the server between requests from a particular client. In this example context, the term “stateless” does not refer to the overall interaction between the user and the application, but instead to the server in question. When a user runs an application from a client (e.g., a web browser), the particular state of the user and application interaction can be kept via the client requests and server responses sent during the application's execution. For example, the state of the application can be kept visibly within the uniform resource locator (URL) returned by the server, or instead may be hidden inside the response sent to the client.
Stateless applications can provide increased scalability—more users can be served by the same machine with respect to memory considerations and single-user CPU loads. However, stateless applications may also present several disadvantages. For example, processing of requests may be slowed due to the application's need to be restarted and reinitialized upon receipt of each request, as each request contains a specific state in which the application should be prior to processing the request. Next, there can be a constant exchange to ensure that the application and associated client maintain the ever-changing state information that would otherwise be stored and maintained at the server.